package org.hcyspartnoc.luoxin.common.exception.framework;


import org.hcyspartnoc.luoxin.common.core.constant.HttpStatus;
import org.hcyspartnoc.luoxin.common.exception.BaseException;

/**
 * @Author: aLittleBai
 * @Description:
 * @DateTime: 2024/2/3 15:35
 **/
public class AuthException extends BaseException {
    public static final String TOKEN_FORMAT_WRONG = "token格式错误！";
    public static final String TOKEN_IS_EXPIRES = "token过期或不正确，请重新登录！";
    public static final String PERMISSION_FAILED = "鉴权失败，请先登录！";
    public static final String PERMISSION_NOT_ENOUGH = "权限不足！";

    public AuthException(String msg) {
        super(msg);
    }

    public AuthException(String msg, int code) {
        super(msg, code);
    }
    public static AuthException errorOfTokenExpires(){
        return new AuthException(TOKEN_IS_EXPIRES, HttpStatus.UNAUTHORIZED);
    }
    public static AuthException errorOfPermissionFailed(){
        return new AuthException(AuthException.PERMISSION_NOT_ENOUGH, HttpStatus.UNAUTHORIZED);
    }
}
